/*******************************************************************************
 * Copyright (c) 2012 Philip Douglas.
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
 * You can obtain one at http://mozilla.org/MPL/2.0/.
 ******************************************************************************/
package net.pdouglas.revisiondroid;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

public class PowerStateReceiver extends BroadcastReceiver {
    private RevisionDroid mParent;

	public PowerStateReceiver(RevisionDroid parent) {
		super();
		
		mParent = parent;
	}

	@Override
	public void onReceive(Context context, Intent intent) {
		String action = intent.getAction();
		
		if (action.equals(Intent.ACTION_POWER_CONNECTED)) {
			mParent.powerConnect();
		}
		else if ((action).equals(Intent.ACTION_POWER_DISCONNECTED)) {
			mParent.powerDisconnect();
		}
	}

}
